#ifndef CUDA_PERSON_H
#define CUDA_PERSON_H
#include "CudaEpiModel.h"
#include <sys/time.h> 
#include <omp.h>

using namespace std;

struct CPUtoGPUPerson{
	unsigned char status;	
	char iday;    
	unsigned char ibits;
	unsigned char vbits;
	unsigned char vday;
	
	CPUtoGPUPerson(){}
	
	__host__
	void CopyFromCPU(Person& p){
		status = p.status;
		iday = p.iday;
		ibits = p.ibits;
		vbits = p.vbits;
		vday = p.vday;
	}
};


typedef thrust::device_vector<CPUtoGPUPerson> dCPUtoGPUPersonVec;
typedef vector<CPUtoGPUPerson> hCPUtoGPUPersonVec;

struct GPUtoCPUPerson{
	unsigned char status;	
	char iday;    
	unsigned char ibits;
	int nInfectedTime;
	
	GPUtoCPUPerson(){}
	
	__host__
	void CopyToCPU(Person& p){
		p.status = status;
		p.iday = iday;
		p.ibits = ibits;
		p.nInfectedTime = nInfectedTime;
	}
};


typedef thrust::device_vector<GPUtoCPUPerson> dGPUtoCPUPersonVec;
typedef vector<GPUtoCPUPerson> hGPUtoCPUPersonVec;


void CopyFromCPUtoGPU(
	vector<Person>& cpu_person, dPersonVec* gpu_person,
	hCPUtoGPUPersonVec* cpu_temp_person, dCPUtoGPUPersonVec* gpu_temp_person,int pos, int size);

void CopyFromGPUtoCPU(
	vector<Person>&  cpu_person, dPersonVec* gpu_person,
	hGPUtoCPUPersonVec* cpu_temp_person, dGPUtoCPUPersonVec* gpu_temp_person,int pos, int size);

extern dCPUtoGPUPersonVec* home_cpu_to_gpu_device_vec;
extern hCPUtoGPUPersonVec* home_cpu_to_gpu_host_vec;
extern dCPUtoGPUPersonVec* worker_cpu_to_gpu_device_vec;
extern hCPUtoGPUPersonVec* worker_cpu_to_gpu_host_vec;

extern dGPUtoCPUPersonVec* home_gpu_to_cpu_device_vec;
extern hGPUtoCPUPersonVec* home_gpu_to_cpu_host_vec;
extern dGPUtoCPUPersonVec* worker_gpu_to_cpu_device_vec;
extern hGPUtoCPUPersonVec* worker_gpu_to_cpu_host_vec;




#endif
